<%--
    Document   : pay01010
    Created on : Nov 17, 2012, 11:10:22 PM
    Author     : HoangTN
--%>

<%@page import="java.util.Calendar"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <title>Payroll</title>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <link href="<%= request.getContextPath()%>/styles/layout.css" rel="stylesheet"
              type="text/css" media="screen" />
        <script src="<%=request.getContextPath()%>/js/arial.js"></script>
        <script src="<%=request.getContextPath()%>/js/cuf_run.js"></script>
        <script src="<%=request.getContextPath()%>/js/cufon-yui.js"></script>
        <script src="<%=request.getContextPath()%>/js/dateUtil.js"></script>
        <script src="<%=request.getContextPath()%>/js/employee.js"></script>
        <script src="<%=request.getContextPath()%>/js/index.js"></script>
        <script src="<%=request.getContextPath()%>/js/menu.js"></script>
        <script src="<%=request.getContextPath()%>/js/tableUtil.js"></script>
        <script src="<%=request.getContextPath()%>/js/log/log02010.js"></script>
        <script src="<%=request.getContextPath()%>/js/pay/pay01010.js"></script>
    </head>
    <body id="top">
        <c:if test="${empty sessionScope.USER}">
            <% response.sendRedirect(request.getContextPath() + "/index.jsp");%>
        </c:if>

        <div class="wrapper col1">
            <div id="header">
                <div id="logo">
                    <h1><a href="<%=request.getContextPath()%>/welcome.jsp">BusinessToday</a></h1>
                    <p><strong>Free CSS Website Template</strong></p>
                </div>
                <div id="newsletter">
                    <p><i>Welcome, ${sessionScope.ROLE}
                            <font color="red" size="4">
                                <strong> ${sessionScope.USER}</strong>
                            </font></i>
                    </p>
                    <p align="right"><a href="<%= request.getContextPath()%>/LogoutController">Log out</a> </p>
                </div>
                <br class="clear" />
            </div>
        </div>

        <%@include file="/jsp/common/menu_payroll_field.jsp" %>

        <div class="wrapper col5" style="height: 50%;">
            <div id="container">
                <!---->

                <input type="hidden" id="fromYearValue" value="${param.fromYear}"/>
                <input type="hidden" id="toYearValue" value="${param.toYear}"/>

                <h1>Search payroll</h1>
                <form action="<%= request.getContextPath()%>/SearchPayrollController">
                    <p>From</p>
                    <select name="fromYear" style="width: 80px;height: 21px" >
                        <%
                                    Calendar cal = Calendar.getInstance();
                                    int year = cal.get(Calendar.YEAR);
                                    int month = cal.get(Calendar.MONTH) + 1;

                                    for (int i = year - 10; i <= year; i++) {
                        %>
                        <option value="<%=i%>" <%if (i == year) {%>selected="true"<%}%>><%=i%></option>
                        <%
                                    }
                        %>
                    </select>
                    <select name="fromMonth" style="width: 80px;height: 21px">
                        <%
                                    for (int i = 1; i <= 12; i++) {
                        %>
                        <option value="<%=i%>" <%if (i == month) {%>selected="true"<%}%>><%=i%></option>
                        <%
                                    }
                        %>
                    </select>
                    <br/>
                    <p>To</p>
                    <select name="toYear" style="width: 80px;height: 21px">
                        <%
                                    for (int i = year - 10; i <= year; i++) {
                        %>
                        <option value="<%=i%>" <%if (i == year) {%>selected="true"<%}%>><%=i%></option>
                        <%
                                    }
                        %>
                    </select>
                    <select name="toMonth" style="width: 80px;height: 21px">
                        <%
                                    for (int i = 1; i <= 12; i++) {
                        %>
                        <option value="<%=i%>" <%if (i == month) {%>selected="true"<%}%>><%=i%></option>
                        <%
                                    }
                        %>
                    </select>
                    <br/>
                    <c:set var="role" value="${sessionScope.ROLE}"/>
                    <c:if test="${role=='admin'}">
                        <p>
                            Employee Status
                            <select name="cboEmpStatus" style="width: 80px;height: 21px">
                                <option value="All" selected="true">All</option>
                                <option value="Working">Working</option>
                                <option value="Fired">Fired</option>
                                <option value="Onlyme">Only me</option>
                            </select>
                        </p>
                        <p>
                            Amount higher than <input type="text" name="txtAmount" value="0"/>
                        </p>
                    </c:if>
                    <input type="submit" name="action" value="Search" />

                </form>
                <br/><br/>
                <c:set var="checked" value="${requestScope.checked}"/>
                <c:if test="${not empty checked}">
                    <h1>Search Results</h1>
                    <c:import url="../WEB-INF/payroll.xml" var="xml"/>
                    <c:import url="../WEB-INF/payroll.xsl" var="xslt"/>
                    <x:transform xml="${xml}" xslt="${xslt}"/>
                </c:if>

                <!---->

                <br class="clear" />
            </div>
        </div>
        <%@include file="/jsp/common/footer_field.jsp" %>
        <%@include file="/jsp/common/copyright_field.jsp" %>

    </body>
</html>